﻿@model Cdf54.Ja.SignalR.Chat.Models.ExternalLoginListViewModel
@using Microsoft.Owin.Security;

<h4>Use another service to log in.</h4>
<hr />
@{
    var loginProviders = Context.GetOwinContext().Authentication.GetExternalAuthenticationTypes();
    if (loginProviders.Count() == 0)
    {
        <div>
            <p>
                There are no external authentication services configured. See <a href="http://go.microsoft.com/fwlink/?LinkId=313242">this article</a>
                for details on setting up this ASP.NET application to support logging in via external services.
            </p>
        </div>
    }
    else
    {
        using (Html.BeginForm("ExternalLogin", "Account", new { ReturnUrl = Model.ReturnUrl }))
        {
            @Html.AntiForgeryToken()
            <div id="socialLoginList">
                <p>
                    @foreach (AuthenticationDescription p in loginProviders)
                    {
                        if (@p.AuthenticationType == "Microsoft")
                        {
                            <button type="submit" class="btn btn-default btn-xs" id="@p.AuthenticationType" name="provider" value="@p.AuthenticationType" title="Log in using your @p.Caption account">
                                <span class="fa fa-windows"></span>.@p.AuthenticationType
                            </button>
                        }
                        if (@p.AuthenticationType == "Twitter")
                        {
                            <button type="submit" class="btn btn-default btn-xs" id="@p.AuthenticationType" name="provider" value="@p.AuthenticationType" title="Log in using your @p.Caption account">
                                <span class="fa fa-twitter"></span> @p.AuthenticationType
                            </button>
                        }
                        if (@p.AuthenticationType == "Facebook")
                        {
                            <button type="submit" class="btn btn-default btn-xs" id="@p.AuthenticationType" name="provider" value="@p.AuthenticationType" title="Log in using your @p.Caption account">
                                <span class="fa fa-facebook"></span> @p.AuthenticationType
                            </button>
                        }
                        if (@p.AuthenticationType == "Google")
                        {
                            <button type="submit" class="btn btn-default btn-xs" id="@p.AuthenticationType" name="provider" value="@p.AuthenticationType" title="Log in using your @p.Caption account">
                                <span class="fa fa-google"></span> @p.AuthenticationType
                            </button>
                        }
                        //[10026] ADD: Github for external login
                        if (@p.AuthenticationType == "GitHub")
                        {
                            <button type="submit" class="btn btn-default btn-xs" id="@p.AuthenticationType" name="provider" value="@p.AuthenticationType" title="Log in using your @p.Caption account">
                                <span class="fa fa-github"></span> @p.AuthenticationType
                            </button>
                        }
                        //[10026]

                    }
                </p>
                @*<p>
        Some external providers don't support IP address parameters (Microsoft, Facebook, Google).
    </p>
    <p>
        Add these entries to your <strong>host</strong> file:
        <ul>
            <li>127.0.0.1 www.jowchat.net</li>
            <li>192.168.107.253 www.jowchat192.net</li>
            <li>89.87.172.42 www.jowchat89.net</li>
        </ul>
        <em>Use these link to login with an external provider, depending on your physical location, it will be Intranet, localhost or Internet.</em>
        <ul>
            @{
                //[10012] Show one link (Intranet, Internet, or localhost) in _ExternalLoginsListPartial
                switch (JA.UTILS.Helpers.Utils.GetIpAddressType(Request.ServerVariables["REMOTE_ADDR"]))
                {
                    case JA.UTILS.Helpers.Utils.AddressType.Internet:
                        <li><a href="http://www.jowchat89.net/Cdf54Chat/Account/Login#.VUDlZpMbLO3" target="_blank">Internet</a></li>
                        break;
                    case JA.UTILS.Helpers.Utils.AddressType.Intranet:
                    <li><a href="http://www.jowchat192.net/Cdf54Chat/Account/Login#.VUDlZpMbLO3" target="_blank">Intranet</a></li>
                        break;
                    case JA.UTILS.Helpers.Utils.AddressType.localhost:
                    <li><a href="http://www.jowchat.net/Account/Login#.VUDlZpMbLO3" target="_blank">localhost</a></li>
                        break;
                }
                //[10012]
            }
        </ul>
    </p>*@
            </div>
        }
    }
}
